{% extends 'admin-v2/layout.html.twig' %}

{% set menu = 'admin_v2_certificate_manage' %}

{% block tabs %}
  {% set tab = 'audit' %}
  {% include 'admin-v2/operating/certificate/tabs.html.twig' %}
{% endblock %}

{% block main %}
  <form class="well well-sm form-inline" method="get">
    <div class="form-group">
      <label>{{ 'admin.operation_certificate.certificate.audit.query'|trans }}:</label>
      <select class="form-control" id="keywordType" name="keywordType">
        {{ select_options(dict('certificateAuditSearchTypes'), app.request.get('keywordType')) }}
      </select>
    </div>
    <div class="form-group mll">
      <input class="form-control" name="keyword" type="text"
             placeholder="{{ 'admin.custom_page_manage.keyword_placeholder'|trans }}"
             value="{{ app.request.query.get('keyword') }}">
    </div>
    <button class="btn btn-primary" type="submit">{{ 'form.btn.search'|trans }}</button>
  </form>

  <table class="table table-hover table-striped" id="certificate-table">
    <thead>
    <tr>
      <th>{{ 'user.fields.truename_label'|trans }}</th>
      <th>{{ 'admin.operation_certificate.certificate.audit.certificate_batch'|trans }}</th>
      <th>{{ 'admin.operation_certificate.certificate.audit.apply_time'|trans }}</th>
      <th>{{ 'admin.operation_certificate.certificate.audit.status'|trans }}
      <th>{{ 'admin.operation_certificate.certificate.audit.audit_time'|trans }}</th>
      <th>{{ 'admin.operation_certificate.certificate.audit.reviewer'|trans }}</th>
      <th>{{ 'admin.operation_certificate.certificate.audit.manage'|trans }}</th>
    </tr>
    </thead>
    <tbody>
    {% if records %}
      {% for record in records %}
        {% set user = users[record.userId]| default(null) %}
        {% set target = targets[record.id]| default(null) %}
        {% set reviewer = reviewers[record.auditUserId]| default(null) %}
        {% include 'admin-v2/operating/certificate-audit/certififcate-audit-tr.html.twig' %}
      {% endfor %}
    {% else %}
      <tr>
        <td colspan="20">
          <div class="empty">{{ 'site.datagrid.empty'|trans }}</div>
        </td>
      </tr>
    {% endif %}
    </tbody>
  </table>
  {{ web_macro.paginator(paginator) }}
{% endblock %}